
"use strict";
const path = require("path");
const TransformPages = require('uni-read-pages')
const {webpack} = new TransformPages()

function resolve(dir) {
    return path.join(__dirname, dir);
}

module.exports = {
    lintOnSave: process.env.NODE_ENV === "development",
    // 路径别名
    configureWebpack: {
        name: "捷印",
        resolve: {
            alias: {
                "@": resolve("/"),
                "@i": resolve("/api"),
                "@c": resolve("/components"),
                "@common": resolve("/common"),
                "@s": resolve("/static"),
            },
        },
        plugins: [
            new webpack.DefinePlugin({
                ROUTES: webpack.DefinePlugin.runtimeValue(() => {
                    const tfPages = new TransformPages({
                        includes: ['path', 'name', 'meta']
                    });
                    return JSON.stringify(tfPages.routes)
                }, true )
            })
        ],
    },
};
